package com.itheima.test5;

public class Test {

    public static void main(String[] args) {
        Animal  a = new Dog();
        a.drink();
        a.eat();
        class  Animal2 extends Animal{

            @Override
            public void eat() {

            }
        }
        Animal a1= new Animal2();
        Animal a2= new Animal() {
            @Override
            public void eat() {

            }
        };
        a1.drink();
        a1.eat();
        a2.drink();
        a2.eat();
        Inter inter = new InterImpl();
        inter.sing();
        Inter inter2= new Inter() {
            @Override
            public void sing() {

            }
        };
        inter2.sing();
    }
}

abstract  class Animal{
    public void drink(){
        System.out.println("喝水");
    }
    public abstract  void eat();
}

class  Dog extends Animal{

    @Override
    public void eat() {
        System.out.println("狗吃狗粮");
    }
}

interface  Inter{
    void sing();
}
class InterImpl implements Inter{

    @Override
    public void sing() {

    }
}